package com.woniuxy.joylifemarket.controller;

import com.woniuxy.joylifemarket.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.HashMap;

@RestController
public class ImageController {
    @Autowired
    ImageService imageService;

    /*
    用户上传照片
     */
    @RequestMapping("/addImg")
    public Object addImg(MultipartFile img) {
        String imgName = imageService.addImgService(img);
        HashMap<String, Object> map = new HashMap<>();
        System.out.println("图片地址"+imgName);
        map.put("url",imgName);
        return map;
    }
}
